﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Itop.YHPC.Model;
using Itop.YHPC.controller;
using System.Collections;
using System.Data;

namespace Itop.YHPC.admin {
    public partial class sysgroupuserAjax :AjaxPage<sysgroupuser> {
        protected override IList<sysgroupuser> onRead() {
            
            IList list = Global.SqlMapper.GetList("Select", "select a.GroupID,a.UserID,b.GroupName from sysgroup b,sysgroupuser a where a.GroupID=b.id and a.UserID='" + Request.QueryString["userid"] + "'");
            DataTable dt= ConvertHelper.HashTablesToDataTable(list);
            IList<sysgroupuser> list2 = ConvertHelper.ToIList<sysgroupuser>(dt);
            foreach (sysgroupuser obj in list2) {
                obj.id = obj.CreateID();
            }
            if (list2 == null) list2 = new List<sysgroupuser>();
            return list2;
        }
        protected override bool onCreate(IList<sysgroupuser> list) {
            foreach (sysgroupuser obj in list) {
                
                Global.SqlMapper.Create<sysgroupuser>(obj);
                obj.id = obj.CreateID();
            }
            return true;
        }
        
        protected override bool onDelete(IList<sysgroupuser> list) {
            foreach (sysgroupuser obj in list) {
                Global.SqlMapper.Delete<sysgroupuser>(obj);
            }
            return true;
        }
    }
}
